import * as Cesium from "cesium";


// 加载高德影像底图，高德地图存在坐标偏移问题
export function gdImageryLayer(){
    return new Cesium.UrlTemplateImageryProvider({
        url: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",
        minimumLevel: 3,
        maximumLevel: 18
    });
}


const tdtWebKey = "6b76678a5bf96516565e4bc5a0e6b7c0";
// 添加天地图影像底图
export function tdtImageryLayer(){
    return new Cesium.WebMapTileServiceImageryProvider({
        url:"http://t0.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=" + tdtWebKey,
        layer: "tdtBasicLayer",
        style: "default",
        format: "image/jpeg",
        tileMatrixSetID: "GoogleMapsCompatible",
        // show: false,
    });
}

export function LocalTerrainServer(URL:string){
      // 加载cesiumlab切好的地形数据
    return new Cesium.Terrain(
        Cesium.CesiumTerrainProvider.fromUrl(URL, {
          requestWaterMask: true,
          requestVertexNormals: true
        })
    );
    

}